//
//  TitleModel.m
//  UI19 - Car(汽车之家)
//
//  Created by 韩旭 on 16/8/9.
//  Copyright © 2016年 lanou. All rights reserved.
//

#import "TitleModel.h"
#import "CarModel.h"
@implementation TitleModel

- (instancetype)initWithDic:(NSDictionary *)dic {
    self = [super init];
    if (self) {
        [self setValuesForKeysWithDictionary:dic];
        self.list = [CarModel carModelWithArray:dic[@"list"]];
    }
    return self;
}
+ (instancetype)titleModelWithDic:(NSDictionary *)dic {
    return [[TitleModel alloc] initWithDic:dic];
}
+ (NSArray *)groupArray {
    NSString *path = [[NSBundle mainBundle] pathForResource:@"addJSON" ofType:@"json"];
    NSMutableArray *arrAll = [NSMutableArray array];
    NSData *data = [NSData dataWithContentsOfFile:path];
   NSDictionary *dicJson = [NSJSONSerialization JSONObjectWithData:data options:0 error:nil];
    NSDictionary *dicResult = dicJson[@"result"];
    NSArray *arrBrandlist = dicResult[@"brandlist"];
    for (NSDictionary *dic in arrBrandlist) {
        [arrAll addObject:[TitleModel titleModelWithDic:dic]];
    }
    return arrAll;
}




@end
